package com.joymart.dictionary;

import lombok.Data;

import java.util.LinkedHashMap;
import java.util.Map;

/**字典 */
@Data
public class Dictionary {
    private String name;
    private LinkedHashMap<String, Value> keyValues;

    public String  getItemText(String key) {
        return
        this.getKeyValues().keySet().stream().filter(_key -> _key.equals(key))
                .map(keyValues::get)
                .map(Value::getText)
                .findAny().orElse(key);
    }

    @Data
    public static class Value{
        private String text ;
        private Map<String,Object> addition;
    }
}
